import wx
import wx.aui

###########################################################################
## Class MainFrame
###########################################################################

class MainFrame (wx.Frame):
	
	def __init__(self, parent):
		wx.Frame.__init__ (self, parent, id=wx.ID_ANY, title=u"PYSF", pos=wx.DefaultPosition, size=wx.Size(992, 758), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
		
		self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)
		
		bSizer1 = wx.BoxSizer(wx.VERTICAL)
		
		self.notebook = wx.aui.AuiNotebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.aui.AUI_NB_DEFAULT_STYLE)
		
		bSizer1.Add(self.notebook, 1, wx.EXPAND | wx.ALL, 5)
		
		self.SetSizer(bSizer1)
		self.Layout()
		self.m_menubar1 = wx.MenuBar(0)
		self.m_menu1 = wx.Menu()
		self.m_menuItem2 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"Open a Schedule-flow", u"Open an existing scheduling case", wx.ITEM_NORMAL)
		self.m_menu1.AppendItem(self.m_menuItem2)
		
		self.m_menuItem3 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"Open a Schedule", u"Save the current case", wx.ITEM_NORMAL)
		self.m_menu1.AppendItem(self.m_menuItem3)
		
		self.m_menu1.AppendSeparator()
		
		self.m_menuItem4 = wx.MenuItem(self.m_menu1, wx.ID_ANY, u"Exit", wx.EmptyString, wx.ITEM_NORMAL)
		self.m_menu1.AppendItem(self.m_menuItem4)
		
		self.m_menubar1.Append(self.m_menu1, u"File") 
		
		self.SetMenuBar(self.m_menubar1)
		
		self.textbar = self.CreateStatusBar(3, wx.ST_SIZEGRIP, wx.ID_ANY)
		
		self.Centre(wx.BOTH)
		
		# Connect Events
		self.notebook.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.onPageClose)
		self.Bind(wx.EVT_MENU, self.viewComponents, id=self.m_menuItem2.GetId())
		self.Bind(wx.EVT_MENU, self.viewSchedule, id=self.m_menuItem3.GetId())
		self.Bind(wx.EVT_MENU, self.closeWindow, id=self.m_menuItem4.GetId())
	
	def __del__(self):
		pass
	
	
	# Virtual event handlers, overide them in your derived class
	def onPageClose(self, event):
		event.Skip()
	
	def viewComponents(self, event):
		event.Skip()
	
	def viewSchedule(self, event):
		event.Skip()
	
	def closeWindow(self, event):
		event.Skip()
	

###########################################################################
## Class ComponentPanel
###########################################################################

class ComponentPanel (wx.Panel):
	
	def __init__(self, parent):
		wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(854, 624), style=wx.TAB_TRAVERSAL)
		
		bSizer3 = wx.BoxSizer(wx.HORIZONTAL)
		
		bSizer14 = wx.BoxSizer(wx.VERTICAL)
		
		bSizer7 = wx.BoxSizer(wx.HORIZONTAL)
		
		self.m_staticText19 = wx.StaticText(self, wx.ID_ANY, u"Schedule-flow file location:", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText19.Wrap(-1)
		bSizer7.Add(self.m_staticText19, 0, wx.ALL, 5)
		
		self.flowFilePicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"YAWL Files (.yawl)|*.yawl", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE)
		self.flowFilePicker.SetFont(wx.Font(8, 74, 93, 90, False, "Terminal"))
		
		bSizer7.Add(self.flowFilePicker, 1, wx.ALL | wx.ALIGN_RIGHT, 5)
		
		bSizer14.Add(bSizer7, 0, wx.EXPAND, 5)
		
		self.m_staticText12 = wx.StaticText(self, wx.ID_ANY, u"Message Centre:", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText12.Wrap(-1)
		bSizer14.Add(self.m_staticText12, 0, wx.ALL, 5)
		
		self.consoleText = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY)
		bSizer14.Add(self.consoleText, 1, wx.ALL | wx.EXPAND, 5)
		
		self.m_staticText10 = wx.StaticText(self, wx.ID_ANY, u"Script:", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText10.Wrap(-1)
		bSizer14.Add(self.m_staticText10, 0, wx.ALL, 5)
		
		self.scriptText = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE)
		self.scriptText.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_INFOBK))
		
		bSizer14.Add(self.scriptText, 1, wx.ALL | wx.EXPAND, 5)
		
		gSizer31 = wx.GridSizer(3, 2, 0, 0)
		
		self.execButon = wx.Button(self, wx.ID_ANY, u"Execute script", wx.DefaultPosition, wx.DefaultSize, 0)
		gSizer31.Add(self.execButon, 0, wx.ALL, 5)
		
		self.runButton = wx.Button(self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0)
		gSizer31.Add(self.runButton, 0, wx.ALL, 5)
		
		self.pauseButton = wx.Button(self, wx.ID_ANY, u"Pause/Resume", wx.DefaultPosition, wx.DefaultSize, 0)
		gSizer31.Add(self.pauseButton, 0, wx.ALL, 5)
		
		self.viewSchButton = wx.Button(self, wx.ID_ANY, u"View the best schedule", wx.DefaultPosition, wx.DefaultSize, 0)
		gSizer31.Add(self.viewSchButton, 0, wx.ALL, 5)
		
		self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"Save a copy of the best schedule as:", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText5.Wrap(-1)
		gSizer31.Add(self.m_staticText5, 0, wx.ALL, 5)
		
		self.bestSavePicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"Schedule binary files (.sch)|*.sch", wx.DefaultPosition, wx.DefaultSize, wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL)
		gSizer31.Add(self.bestSavePicker, 0, wx.ALL | wx.EXPAND, 5)
		
		bSizer14.Add(gSizer31, 0, wx.EXPAND, 5)
		
		bSizer3.Add(bSizer14, 2, wx.EXPAND, 5)
		
		self.SetSizer(bSizer3)
		self.Layout()
		
		# Connect Events
		self.flowFilePicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.onFlowFile)
		self.execButon.Bind(wx.EVT_BUTTON, self.onExec)
		self.runButton.Bind(wx.EVT_BUTTON, self.onRun)
		self.pauseButton.Bind(wx.EVT_BUTTON, self.onPause)
		self.viewSchButton.Bind(wx.EVT_BUTTON, self.onViewSch)
		self.bestSavePicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.onSaveBest)
	
	def __del__(self):
		pass
	
	
	# Virtual event handlers, overide them in your derived class
	def onFlowFile(self, event):
		event.Skip()
	
	def onExec(self, event):
		event.Skip()
	
	def onRun(self, event):
		event.Skip()
	
	def onPause(self, event):
		event.Skip()
	
	def onViewSch(self, event):
		event.Skip()
	
	def onSaveBest(self, event):
		event.Skip()
	

###########################################################################
## Class SchedulePanel
###########################################################################

class SchedulePanel (wx.Panel):
	
	def __init__(self, parent):
		wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(791, 723), style=wx.FULL_REPAINT_ON_RESIZE | wx.TAB_TRAVERSAL)
		
		bSizer10 = wx.BoxSizer(wx.VERTICAL)
		
		self.scroll = wx.ScrolledWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.DOUBLE_BORDER | wx.FULL_REPAINT_ON_RESIZE | wx.HSCROLL | wx.VSCROLL)
		self.scroll.SetScrollRate(5, 5)
		self.scroll.SetBackgroundColour(wx.Colour(255, 255, 255))
		
		bSizer10.Add(self.scroll, 1, wx.EXPAND | wx.ALL, 5)
		
		bSizer8 = wx.BoxSizer(wx.HORIZONTAL)
		
		self.m_button3 = wx.Button(self, wx.ID_ANY, u"Zoom In", wx.DefaultPosition, wx.DefaultSize, 0)
		bSizer8.Add(self.m_button3, 0, wx.ALL, 5)
		
		self.m_button4 = wx.Button(self, wx.ID_ANY, u"Zoom Out", wx.DefaultPosition, wx.DefaultSize, 0)
		bSizer8.Add(self.m_button4, 0, wx.ALL, 5)
		
		self.eventText = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE | wx.TE_READONLY)
		bSizer8.Add(self.eventText, 1, wx.ALL | wx.EXPAND, 5)
		
		bSizer10.Add(bSizer8, 0, wx.EXPAND, 5)
		
		bSizer6 = wx.BoxSizer(wx.HORIZONTAL)
		
		self.m_staticText4 = wx.StaticText(self, wx.ID_ANY, u"Load a schedule:", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText4.Wrap(-1)
		bSizer6.Add(self.m_staticText4, 0, wx.ALL, 5)
		
		self.schPicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"Schedule binary files (.sch)|*.sch", wx.DefaultPosition, wx.DefaultSize, wx.FLP_DEFAULT_STYLE)
		bSizer6.Add(self.schPicker, 1, wx.ALL | wx.EXPAND, 5)
		
		self.m_staticText6 = wx.StaticText(self, wx.ID_ANY, u"Save as Bitmap", wx.DefaultPosition, wx.DefaultSize, 0)
		self.m_staticText6.Wrap(-1)
		bSizer6.Add(self.m_staticText6, 0, wx.ALL | wx.EXPAND, 5)
		
		self.bitmapSavePicker = wx.FilePickerCtrl(self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"Bitmap files (.bmp)|*.bmp", wx.DefaultPosition, wx.DefaultSize, wx.FLP_SAVE | wx.FLP_USE_TEXTCTRL)
		bSizer6.Add(self.bitmapSavePicker, 1, wx.ALL | wx.EXPAND, 5)
		
		bSizer10.Add(bSizer6, 0, wx.EXPAND, 5)
		
		self.SetSizer(bSizer10)
		self.Layout()
		
		# Connect Events
		self.scroll.Bind(wx.EVT_LEFT_DCLICK, self.onDoubleClick)
		self.scroll.Bind(wx.EVT_PAINT, self.onPaint)
		self.m_button3.Bind(wx.EVT_BUTTON, self.onZoomIn)
		self.m_button4.Bind(wx.EVT_BUTTON, self.onZoomOut)
		self.schPicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.onLoadSchedule)
		self.bitmapSavePicker.Bind(wx.EVT_FILEPICKER_CHANGED, self.onSaveBitmap)
	
	def __del__(self):
		pass
	
	
	# Virtual event handlers, overide them in your derived class
	def onDoubleClick(self, event):
		event.Skip()
	
	def onPaint(self, event):
		event.Skip()
	
	def onZoomIn(self, event):
		event.Skip()
	
	def onZoomOut(self, event):
		event.Skip()
	
	def onLoadSchedule(self, event):
		event.Skip()
	
	def onSaveBitmap(self, event):
		event.Skip()
	

